<include file="__PUBLIC__/_header" />
<link href="__APP_SKIN__js/uploadify/uploadify.css?2" rel="stylesheet" type="text/css" />
<link href="__SKIN__/bootstrap-3.3.7/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css" rel="stylesheet" media="screen">
<div class="main-container" id="main-container">

    <div class="main-content" style="margin-left: 0;">
        <div class="page-content">
            <!-- /.page-header -->
            <div class="row">
                <div class="col-xs-12">
                    <div class="row">
                        <div class="col-sm-12">
                            <form class="form-horizontal" id="myform" role="form"  method="post" name="edit-form" >
                                <table id="data-table" class="table table-bordered table-hover definewidth m10" >
                                    <tbody>
                                    <tr>
                                        <th width="10%">标题</th>
                                        <td>
                                            <input type="text" name="title">
                                        </td>
                                    </tr>
                                    </tbody>
                                    <tfoot>
                                    <tr>
                                        <td colspan="13">
                                            <button class="btn btn-info" type="button" id="base_submit"> <i class="icon-ok bigger-110"></i> 确定 </button>
                                        </td>
                                    </tr>
                                    </tfoot>
                                </table>
                            </form>
                        </div>

                        <!-- /span -->
                    </div>
                    <!-- /row -->
                </div>
                <!-- PAGE CONTENT ENDS -->
            </div>
            <!-- /.row -->
        </div>
    </div>
</div>
</div>
<input type="hidden" id="update_img" value="{$arr['img']}">
<input type="hidden" id="uploadSwf" value="__APP_SKIN__js/uploadify/uploadify.swf">
<input type="hidden" id="uploader" value="{:Controller::createUrl('vis/file/index')}">
<input type="hidden" id="service_url" value="{:Controller::getConfig('file_server_url')}">

<script src="__APP_SKIN__js/jquery-2.0.3.min.js"></script>
<script src="__APP_SKIN__js/bootstrap.min.js"></script>
<script src="__APP_SKIN__js/uploadify/jquery.uploadify.js?12" type="text/javascript"></script>
<script>

    function chk_form(){

        if($('input[name=title]').val() =='' || $('input[name=title]').val() ==''){
            $('input[name=title]').focus();
            $('input[name=title]').html('标题或空');
            return false;
        }
    }
    $(function () {
        $("#base_submit").click(function(){
            $.ajax({
                //几个参数需要注意一下
                type: "POST",//方法类型
                dataType: "json",//预期服务器返回的数据类型
                url:"{:Controller::_createUrl('promotion/addKind')}",
                data: $('#myform').serialize(),
                success: function (result) {
                    console.log(result);//打印服务端返回的数据(调试用)
                    if (result.code == 200) {
                        window.parent.location.reload();
                    }else{
                        alert('添加失败');
                    }
                },
                error : function() {
                    return false;
                }
            });
        });
    })
</script>
<script type="text/javascript" src="__SKIN__/bootstrap-3.3.7/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js" charset="UTF-8"></script>
<script type="text/javascript" src="__SKIN__/bootstrap-3.3.7/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
<script src="__SKIN__/bootstrap-3.3.7/js/jquery.spinner.min.js"></script>
<script type="text/javascript">
    $('.type6').datetimepicker({
        language:  'zh-CN',
        format: 'yyyy-mm-dd H:i:s',
        weekStart: 1,
        todayBtn:  1,
        autoclose: 1,
        todayHighlight: 1,
        startView: 2,
        minView: 2,
        forceParse: 0
    });
</script>
</body>
</html>